package com.hanliy.es.document;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;

/**
 * @author hanyulin
 * @apiNote 商品文档对象
 * @date 2021/11/24 14:36
 */
@Data
@Document(indexName = "testdoc")
@AllArgsConstructor
public class EsProduct implements Serializable {

    private static final long serialVersionUID = 1L;
    /**
     * 主键
     */
    @Id
    private long id;

    /**
     *
     * 这里配置了分词器，字段类型，可以不配置，默认也可
     */
    @Field(analyzer = "ik_smart", type = FieldType.Text)
    private String name;

    private Integer age;

    private String sex;

    @Field(analyzer = "ik_smart", type = FieldType.Text)
    private String desc;
}
